<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\GitController;
use App\Http\Controllers\FileController;
use App\Http\Controllers\FolderController;
use App\Http\Controllers\LoginController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::get('hello', function() {return "hello, api";});

Route::group(['middleware'=>['apiToken']], function() {
    Route::any('git/checkGitProject',   [GitController::class, 'checkGitProject']);
    Route::any('git/createGitProject',  [GitController::class, 'createGitProject']);

    Route::any('user/login',            [LoginController::class, 'login']);
    Route::any('user/info',             [LoginController::class, 'info']);
    Route::any('user/logout',           [LoginController::class, 'logout']);

    Route::any('file/search',           [FileController::class, 'search']);
    Route::any('file/scanFile',         [FileController::class, 'scanFile']);
    Route::any('file/upload',           [FileController::class, 'upload']);
    Route::any('file/merge',            [FileController::class, 'merge']);
    Route::any('file/update',           [FileController::class, 'update']);

    Route::any('folder/index',          [FolderController::class, 'index']);
    Route::any('folder/add',            [FolderController::class, 'add']);
    Route::any('folder/update',         [FolderController::class, 'update']);
    Route::any('folder/delete',         [FolderController::class, 'delete']);
});
